package com.zzptc.zzsgz.bdsjws.fragments;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zzptc.zzsgz.bdsjws.MyApplication;
import com.zzptc.zzsgz.bdsjws.R;
import com.zzptc.zzsgz.bdsjws.adapter.ContactAdapter;
import com.zzptc.zzsgz.bdsjws.fragments.base.BaseFragmentbase;
import com.zzptc.zzsgz.bdsjws.utils.MyUtils;
import com.zzptc.zzsgz.bdsjws.vo.Contact;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/6/5.
 */

public class ShowAllContectFragment extends BaseFragmentbase {
    List<Contact> list;
    @BindView(R.id.show_contact)
    RecyclerView showContact;

    @Override
    public int getXML() {
        return R.layout.show_all_contect;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initDate() {
        //得到数据
//        new Thread(new Runnable() {
//
//            @Override
//            public void run() {
//                list=MyUtils.getAllContact();
//            }
//        }).start();

        list= MyApplication.getList();
        //写适配器
        if(list.size()!=0){
            TextView textView= (TextView) getActivity().findViewById(R.id.tv_add);

            ContactAdapter adapter = new ContactAdapter(list,textView);
            //布局管理者
            showContact.setLayoutManager(new LinearLayoutManager(getActivity()));
            showContact.setAdapter(adapter);
        }


    }
}
